package com.clouddot.baipai.model;


import android.content.Context;

import com.clouddot.baipai.contract.IH_SMainActivityContract;
import com.clouddot.baipai.http.BanPaiRetrofitHelper;
import com.clouddot.baipai.http.WeatherRetrofitHelper;
import com.clouddot.baipai.http.entity.response.addEvaluateResponse;
import com.clouddot.baipai.http.entity.response.getBanPaiModelResponse;
import com.clouddot.baipai.http.entity.response.getClassInfoResponse;
import com.clouddot.baipai.http.entity.response.getCommitteeResponse;
import com.clouddot.baipai.http.entity.response.getIndexListResponse;
import com.clouddot.baipai.http.entity.response.getPersonInfoResponse;
import com.clouddot.baipai.http.entity.response.loginResponse;
import com.clouddot.baipai.infrastructure.environment.Env;

import org.wxy.sdk.base.impl.BaseModelImpl;

import java.util.ArrayList;

import rx.Observable;

public class H_SMainActivityModel extends BaseModelImpl implements IH_SMainActivityContract.IModel {
    public H_SMainActivityModel(Context context) {
        super(context);

    }


    @Override
    public Observable<getClassInfoResponse> getClassInfo(String acttype, String carddevid) {
        return BanPaiRetrofitHelper.getInstance(Env.getContent()).getServer().getClassInfo(Env.getAppContext().IP,acttype,carddevid);
    }

    @Override
    public Observable<loginResponse> login(String acttype, String code) {
        return BanPaiRetrofitHelper.getInstance(Env.getContent()).getServer().login(Env.getAppContext().IP,acttype,code);
    }

    @Override
    public Observable<loginResponse> loginByPhoto(String acttype, String code, String filepath) {
        return BanPaiRetrofitHelper.getInstance(Env.getContent()).getServer().loginByPhoto(Env.getAppContext().IP,acttype,code,filepath);
    }

    @Override
    public Observable<getPersonInfoResponse> getPerson(String acttype) {
        return BanPaiRetrofitHelper.getInstance(Env.getContent()).getServer().getPersonInfo(Env.getAppContext().IP,acttype);
    }

    @Override
    public Observable<String> getWeather(String cityKey) {
        return WeatherRetrofitHelper.getInstance(Env.getContent()).getServer().getWeatherInfo(cityKey);
    }

    @Override
    public Observable<getBanPaiModelResponse> getBanPaiModel(String acttype, String paramname) {
        return BanPaiRetrofitHelper.getInstance(Env.getContent()).getServer().getBanPaiModel(Env.getAppContext().IP,acttype,paramname);
    }

    @Override
    public Observable<ArrayList<getCommitteeResponse>> getCommittee(String acttype, String ClassId, String code) {
        return BanPaiRetrofitHelper.getInstance(Env.getContent()).getServer().getCommittee(Env.getAppContext().IP,acttype,ClassId,code);
    }


    @Override
    public Observable<addEvaluateResponse> addEvaluate(String acttype, String ClassId, String ObjectId, String ValType, String UserId, String WeekId,String SetValue) {
        return BanPaiRetrofitHelper.getInstance(Env.getContent()).getServer().addEvaluate(Env.getAppContext().IP,acttype,ClassId,ObjectId,ValType,UserId,WeekId,SetValue);
    }


    @Override
    public Observable<getIndexListResponse> getIndexList(String acttype, String ObjectType, int pageindex, int pagesize) {
        return  BanPaiRetrofitHelper.getInstance(Env.getContent()).getServer().getIndexList(Env.getAppContext().IP,acttype,ObjectType,pageindex,pagesize);
    }
}
